import service from "../index";

// 获取用户列表
export const getUserList = async () => {
  return await service({
    method: "get",
    url: "/user/getAllUser",
  });
};

//获取房主
export const getHostList = async () => {
  return await service({
    method: "get",
    url: "/user/getHost",
  });
};

// 添加用户
export const addUser = async (formData: any) => {
  return await service({
    method: "post",
    url: "/user/addUser",
    data: formData,
  });
};

//编辑用户
export const editUser = async (formData: any) => {
  return await service({
    method: "post",
    url: "/user/editUser",
    data: formData,
  });
};

//删除用户
export const deleteUser = async (id: number) => {
  return await service({
    method: "post",
    url: "/user/deleteUser",
    data: { id: id },
  });
};

//批量删除用户
export const batchDeleteUser = async (ids: any) => {
  return await service({
    method: "post",
    url: "/user/batchDeleteUser",
    data: { ids: ids },
  });
};

//搜索用户
export const searchUser = async (formData: any) => {
  return await service({
    method: "post",
    url: "/user/searchUser",
    data: formData,
  });
};

//搜索房主
export const searchHost = async (params: any) => {
  return await service({
    method: "post",
    url: "/user/searchHost",
    data: params,
  });
};

//获取房客
export const getGuest = async () => {
  return await service({
    method: "get",
    url: "/user/getGuest",
  });
};

//搜索admin
export const searchGuest = async (formData: any) => {
  return await service({
    method: "post",
    url: "/user/searchGuest",
    data: formData,
  });
};

//获取admin
export const getAdminList = async () => {
  return await service({
    method: "get",
    url: "/user/getAdminList",
  });
};

//搜索房客
export const searchAdmin = async (formData: any) => {
  return await service({
    method: "post",
    url: "/user/searchAdmin",
    data: formData,
  });
};

//根据订单获取用户
export const getUserByOrder = async (homeId: any) => {
  return await service({
    method: "get",
    url: "/user/getUserByOrder?homeId=" + homeId,
  });
};
//搜索订单房客
export const searchOrderGuestByname = async (formData: any) => {
  return await service({
    method: "post",
    url: "/user/searchOrderGuestByname",
    data: formData,
  });
};
